package com.cms.common.exception;

public class SystemException {
    public static void throwException(int viewType, String message) {
        if (viewType == ViewTypeEnum.WEB_ADMIN.getIndex()) {
            throw new WebException(message);
        } else if (viewType == ViewTypeEnum.API_ADMIN.getIndex()) {
            throw new ApiException(message);
        }
    }

    public static void throwException(int viewType, String message, int code) {
        if (viewType == ViewTypeEnum.WEB_ADMIN.getIndex()) {
            throw new WebException(code, message);
        } else if (viewType == ViewTypeEnum.API_ADMIN.getIndex()) {
            throw new ApiException(code, message);
        }
    }
}